package bsqxday11;
import java.util.*;
//倒置字符串
//链接：https://www.nowcoder.com/practice/ee5de2e7c45a46a090c1ced2fdc62355?tpId=182&tqId=34788&ru=/exam/oj
public class Test3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        Stack<String> stack = new Stack<>();
        String str = in.nextLine();
        String[] words = new String[100];
        words = str.split(" ");
        for(String tmp : words) {
            stack.push(tmp);
        }
        int n = stack.size();
        while(n > 0) {
            System.out.print(stack.pop()+" ");
            n--;
        }
    }
}
